|
|
|
|
|
|
|
These two lines of code appear at the end of the section. They declare local storage space for the new properties. Now use the Tools | Add Procedure menu option to add two new Public properties to the class: LogFileName and WriteLogFlag. Listing 14.25 shows the code you need to add to the Property Let and Property Get statements for these two new properties. |
|
|
|
|
|
|
|
|
Listing 14.25. Coding the Property Let and Property Get statements for the LogFileName and WriteLogFlag properties. |
|
|
|
|
|
|
|
|
Public Property Get LogFileName() As String
'
LogFileName = errLogFileName
'
End Property
Public Property Let LogFileName(ByVal vNewValue As String)
'
errLogFileName = vNewValue
'
End Property
Public Property Get WriteLogFlag() As Boolean
'
WriteLogFlag = errLogFlag
'
End Property
Public Property Let WriteLogFlag(ByVal vNewValue As Boolean)
'
errLogFlag = vNewValue
'
End Property |
|
|
|
|
|
|
|
|
The LogFileName property is used to hold the name of the disk file that holds the log records. The LogFlag property controls the status of the error logging. If the LogFlag property is set to True, log records are created. Now add the following code to the end of the Class_Initialize event. This sets the default values for the two new properties. |
|
|
|
|
|
|
|
|
errLogFileName = App.EXEName & ".err"
errLogFlag = False
' |
|
|
|
|
|
|
|
|
Now create a new Private Sub method called LogError and enter the code from Listing 14.26 into the routine. This is the code that actually creates the log entries. |
|
|
|
|
|